Next | Prev | Up | Top | Contents | Index

Host Adapter Initialization

In its initialization, the host adapter driver does three things:


Initializing the Hardware

If it is called at its pfxedtinit() entry point, the host adapter driver receives adapter hardware information in an edt_t structure. Integration of the driver in this way, using a VECTOR line, is preferred. It removes the need to hard-code device addresses; and it allows the use of an exprobe operand to load the driver only when its adapter hardware is present.

If it is not loaded by a VECTOR line, the driver must be loaded with a USE line in the system database (see "Configuring a Kernel") and it must find out the address of its adapter hardware by other means.

The driver may also include a pfxstart() entry point for general initialization, including the two steps of acquiring a type number and setting up its entry point addresses.


Acquiring a Type Number

Every host adapter driver must have a unique adapter type number. The type numbers for Silicon Graphics drivers are declared in sys/scsi.h. An OEM driver acquires a number dynamically, by calling the kernel function get_driver_number(). The prototype of this function is

uchar get_driver_number(void);

If successful, the function returns a number between SCSIDRIVER_3RD_PARTY_START and SCSIDRIVER_3RD_PARTY_END, inclusive (see Table 15-1). If unsuccessful, it returns -1, and the driver cannot initialize.


Storing Entry Point Addresses

After it has its type number, the driver can store the address of each of its functional entry points in the arrays used by its callers. For example it stores the address of its command execution function in the scsi_command array, indexed by its type number.

The driver must support the functions summarized in Table 15-2. For each function there is a corresponding array of function pointers, in which the driver stores the address of its function, indexed by its driver type number.


Next | Prev | Up | Top | Contents | Index